package cc.yugu.yhdw.common.domain.hdw;

import cc.yugu.yhdw.common.domain.IntIdEntity;

import java.util.HashMap;
import java.util.Map;

public class ExchangeAmountMoneyDivideDetail extends IntIdEntity {
    public enum OrgType {
        HQ(1, "总部"),
        CABINET(2, "柜子厂商"),
        POWER(3, "电源厂商"),
        BATTERY(4, "电池厂商"),
        AGENCY(5, "代理商"),
        AGENT(6, "运营商"),;

        private final int value;
        private final String name;

        private OrgType(int value, String name) {
            this.value = value;
            this.name = name;
        }

        private static Map<Integer, String> map = new HashMap<Integer, String>();

        static {
            for (OrgType e : OrgType.values()) {
                map.put(e.getValue(), e.getName());
            }
        }

        public static String getName(int value) {
            return map.get(value);
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    protected Integer divideId; //换电方案id
    protected Integer amount; //换电次数
    protected Integer orgType; //分配单位类型 1 总部 2 柜子厂商 3 电源厂商 4 电池厂商 5 代理商 6 运营商
    protected Integer orgId; //分配单位id
    protected Integer percent; //分配比例, 相同的 amount 的所有percent必须等于100

    protected String orgTypeName;
    protected String orgIdName;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ExchangeAmountMoneyDivideDetail that = (ExchangeAmountMoneyDivideDetail) o;

        if (divideId != null ? !divideId.equals(that.divideId) : that.divideId != null) return false;
        if (amount != null ? !amount.equals(that.amount) : that.amount != null) return false;
        if (orgType != null ? !orgType.equals(that.orgType) : that.orgType != null) return false;
        return !(orgId != null ? !orgId.equals(that.orgId) : that.orgId != null);

    }

    @Override
    public int hashCode() {
        int result = divideId != null ? divideId.hashCode() : 0;
        result = 31 * result + (amount != null ? amount.hashCode() : 0);
        result = 31 * result + (orgType != null ? orgType.hashCode() : 0);
        result = 31 * result + (orgId != null ? orgId.hashCode() : 0);
        return result;
    }

    public String getOrgTypeName() {
        return orgTypeName;
    }

    public void setOrgTypeName(String orgTypeName) {
        this.orgTypeName = orgTypeName;
    }

    public String getOrgIdName() {
        return orgIdName;
    }

    public void setOrgIdName(String orgIdName) {
        this.orgIdName = orgIdName;
    }

    public Integer getDivideId() {
        return divideId;
    }

    public void setDivideId(Integer divideId) {
        this.divideId = divideId;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public Integer getOrgType() {
        return orgType;
    }

    public void setOrgType(Integer orgType) {
        this.orgType = orgType;
    }

    public Integer getOrgId() {
        return orgId;
    }

    public void setOrgId(Integer orgId) {
        this.orgId = orgId;
    }

    public Integer getPercent() {
        return percent;
    }

    public void setPercent(Integer percent) {
        this.percent = percent;
    }
}
